package DaoTest;

import com.itheima.pojo.Items;
import com.itheima.dao.ItemsDao;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;

public class testDao {
    @Test
    public void testDao() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring_mybatis.xml");
        ItemsDao itemsDao = applicationContext.getBean(ItemsDao.class);
        System.out.println("商品列表：：："+itemsDao.findAll());

        Items items = new Items();
        items.setName("西瓜");
        items.setPrice(16666f);
        items.setCreatetime(new Date());
        itemsDao.save(items);
    }
}
